=========================================================================== BBS: The Abacus * HST/DS * Potterville MI Date: 02-11-93 (11:52) Number: 97 From: MARK BUTLER Refer#: NONE To: RUSTY GORDON Recvd: NO Subj: EditLine 1/2 Conf: (35) Quick Basi --------------------------------------------------------------------------- Once upon a time Rusty Gordon uttered these sage words to All: RG> ....how do I put a limit to the number of characters the RG> user can enter as in the sample below: RG> Enter Feature Name 北北北北北北北. I don't know about short but this'll work... ==========================8< Cut Here 8<============================= DEFINT A-Z DECLARE SUB EditLine (a$, exitCode) DECLARE FUNCTION ScanCode () CLS LOCATE 12, 1 PRINT "Enter a 9 character string: "; a$ = SPACE$(9) COLOR 0, 7 CALL EditLine(a$, exitCode) COLOR 7, 0 PRINT PRINT PRINT "a$ = "; a$ PRINT "exitCode ="; exitCode '*** 'exitCode%' will help you to discren whether the user wants '*** go back up to the field above, or the field below the current, '*** or abort without change etc etc. SUB EditLine (a$, exitCode) STATIC CONST FALSE = 0, TRUE = NOT FALSE CONST BACKSPACE = 8 CONST CTRLLEFTARROW = -115 CONST CTRLRIGHTARROW = -116 CONST CTRLY = 25 CONST CTRLQ = 17 CONST DELETEKEY = -83 CONST DOWNARROW = -80 CONST ENDKEY = -79 CONST ENTER = 13 CONST ESCAPE = 27 CONST HOME = -71 CONST INSERTKEY = -82 CONST LEFTARROW = -75 CONST RIGHTARROW = -77 CONST TABKEY = 9 CONST UPARROW = -72 row = CSRLIN col = POS(0) length = LEN(a$) ptr = 0 insirt = TRUE quit = FALSE original$ = a$ DO LOCATE row, col, 0 PRINT a$; IF insirt THEN LOCATE row, col + ptr, 1, 6, 7 ELSE LOCATE row, col + ptr, 1, 1, 7 END IF kee = ScanCode SELECT CASE kee CASE INSERTKEY IF insirt THEN insirt = FALSE ELSE insirt = TRUE END IF CASE BACKSPACE IF ptr THEN a$ = a$ + " " a$ = LEFT$(a$, ptr - 1) + MID$(a$, ptr + 1) ptr = ptr - 1 END IF CASE DELETEKEY a$ = a$ + " " a$ = LEFT$(a$, ptr) + MID$(a$, ptr + 2) CASE UPARROW exitCode = 1 quit = TRUE CASE DOWNARROW exitCode = -1 quit = TRUE CASE LEFTARROW IF ptr THEN ptr = ptr - 1 END IF CASE RIGHTARROW IF ptr < length - 1 THEN ptr = ptr + 1 ==========================8< Cut Here 8<============================= >>> continued to the next message --- timEd/B7 * This is your eggs on fried drugs..er..uh..aw forget it. * Origin: Terminal Oasis, Portland OR (1:105/330.5) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 950 203/23 209/209 280/1 SEEN-BY: 390/1 396/1 15 397/2 2230/100 3603/20